<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserAddressTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //用户收货地址表
        Schema::create('user_address', function(Blueprint $table) {
            $table->bigIncrements('id')->comment('地址标识');
            $table->bigInteger('enterprise_id') ->default(0)->comment('所属企业');
            $table->bigInteger('user_id')->comment('用户标识');
            $table->string('consignee')  ->default('')->comment('收件人');
            $table->string('province')   ->default('')->comment('省份');
            $table->string('city')       ->default('')->comment('城市');
            $table->string('area')       ->default('')->comment('地区');
            $table->string('address')    ->default('')->comment('详细地址');
            $table->string('postcode')   ->default('')->comment('邮政编码');
            $table->string('phone')      ->default('')->comment('手机号');
            $table->integer('is_default')->default(0)->comment('是否默认地址，0：否，1：是');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_address');
    }
}
